<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<jsp:useBean id="comManager" class="manager.CommentManager" scope="page" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<link rel="stylesheet" type="text/css" href="system/css/main.css" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Comments</title>
</head>
<body>
	<div align="left">
		<form
			action="../NewCommentServlet?id=${car.id}" name="iForm" onSubmit="return checkInput();" method="post">
			<br/><label>Insert Comment</label><br/>
			<textarea name='test' id='test' rows="5" cols="25"></textarea><br/>
			<input type="submit" value="Add Comment">
		</form><br/>
		<table align="left" border="1">
			<tr>
				<th>All Comments</th>
			</tr>
			<c:if test="${empty cars}">
				<c:forEach var="com" items="${comManager.getAllCarComments(car)}">
					<tr>
						<td>${com.text }</td>
					</tr>
				</c:forEach>
			</c:if>
		</table>
	</div>
	<script type="text/javascript">
		function checkInput(){
			if (document.iForm.test.value == '') {
				alert("Please insert comment");
				return false;
			}else{
				return true;
			}
		};
	</script>
</body>
</html>